import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'
// import store from '../store'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
// debugger
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/Register', component: () => import('@/views/login/Register'), hidden: true },
  { path: '/chooseShop', component: () => import('@/views/login/chooseShop'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path: '/changePS',
    component: Layout,
    name: 'changePS',
    hidden: true,
    children: [{
      path: 'changePS',
      component: () => import('@/views/login/changePS')
    }]
  },
  {
    path: '/passWord',
    component: Layout,
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index')
    }]
  },

  // {
  //   path: '/example',
  //   component: Layout,
  //   name: 'example',
  //   hidden: false,
  //   meta: { title: '每日基础数据', icon: 'example', perm: 'bussiness|base_event' },
  //   alwaysShow: true,
  //   children: [{
  //     name: '每日数据统计1',
  //     path: '/example/cp_order',
  //     component: () => import('@/views/ansysis/cp_order'),
  //     role: 'cp_order',
  //     meta: { title: '购彩统计', icon: 'jichu', event_id: 'cp_lottery', perm: 'bussiness|cp_lottery' }
  //   }, {
  //     name: 'Tax',
  //     path: '/example/Tax',
  //     component: () => import('@/views/ansysis/Tax'),
  //     role: 'cp_order',
  //     meta: { title: '税收统计', icon: 'zhexian', event_id: 'tax', perm: 'bussiness|tax' }
  //   },
  //   {
  //     name: '充值分析',
  //     path: '/example/recharge',
  //     role: 'cp_order',
  //     component: () => import('@/views/ansysis/recharge'),
  //     meta: { title: '充值统计', icon: 'link', event_id: 'recharge', perm: 'bussiness|recharge' }
  //   }, {
  //     name: '充值明细',
  //     path: '/example/RechargeDetail',
  //     component: () => import('@/views/ansysis/RechargeDetail'),
  //     meta: { title: '充值明细', icon: 'youhua', event_id: 'recharge', perm: 'bussiness|recharge_detail' }
  //   }, {
  //     name: '提现分析',
  //     path: '/example/withdraw',
  //     role: 'cp_order',
  //     component: () => import('@/views/ansysis/withdraw'),
  //     meta: { title: '提现统计', icon: 'nested', event_id: 'withdraw', perm: 'bussiness|withdraw' }
  //   }, {
  //     name: 'WithdrawDetail',
  //     path: '/example/WithdrawDetail',
  //     component: () => import('@/views/ansysis/WithdrawDetail'),
  //     meta: { title: '提现明细', icon: 'jichu', event_id: 'withdraw', perm: 'bussiness|withdraw_detail' }
  //   }, {
  //     name: '系统奖励统计',
  //     path: '/example/reward',
  //     component: () => import('@/views/ansysis/Reward'),
  //     meta: { title: '系统奖励明细', icon: 'guizheyinqin', perm: 'bussiness|platform_reward_detail' }
  //   }]
  // },
  {
    path: '/productAnalyse',
    component: Layout,
    name: 'productAnalyse',
    meta: { title: '产品数据分析', icon: 'zhexian', perm: 'bussiness|2000' },
    children: [
      {
        path: 'UserEveryday',
        name: 'UserEveryday',
        component: () => import('@/views/operationAnalyse/UserEveryday'),
      meta: { title: '每日整体分析', icon: 'youhua', perm: 'bussiness|3005' }
    },
      {
        path: 'DWC',
        name: 'DWC',
        component: () => import('@/views/productAnalyse/DWC'),
        meta: { title: '每日玩法分析', icon: 'guizheyinqin', perm: 'bussiness|2004' }
      },
    {
      path: 'Charge',
          name: 'Charge',
        component: () => import('@/views/operationAnalyse/Charge'),
        meta: { title: '每日充值分析', icon: 'wendang', from: 'Overview', perm: 'bussiness|3006' }
    },
    {
      path: 'Withdraw',
          name: 'Withdraw',
        component: () => import('@/views/operationAnalyse/Withdraw'),
        meta: { title: '每日提现分析', icon: 'wendang', from: 'Overview', perm: 'bussiness|3008' }
    },
      // {
      //   path: 'lottery',
      //   name: 'lottery',
      //   component: () => import('@/views/productAnalyse/lottery'),
      //   meta: { title: '转转转分析', icon: 'eye', from: 'lottery', perm: 'bussiness|2002' }
      // },
      // {
      //   path: 'bull',
      //   name: 'bull',
      //   component: () => import('@/views/productAnalyse/bull'),
      //   meta: { title: '牛牛分析', icon: 'tree', from: 'bull', perm: 'bussiness|2001' }
      // }
    ]
  },
  {
    path: '/operationAnalyse',
    component: Layout,
    name: 'operationAnalyse',
    alwaysShow: true,
    meta: { title: '运营数据分析', icon: 'wendang', perm: 'bussiness|3000' },
    children: [
      // {
      //   path: 'everyday',
      //   name: 'everyday',
      //   component: () => import('@/views/operationAnalyse/everyday'),
      //   meta: { title: '每日利润分析', icon: 'table', perm: 'bussiness|3001' }
      // },
      // {
      //   path: 'dailyGeneral',
      //   name: 'dailyGeneral',
      //   component: () => import('@/views/operationAnalyse/dailyGeneral'),
      //   meta: { title: '每日整体分析', icon: 'eye', perm: 'bussiness|3002' }
      // },

      {
        path: 'Daily',
        name: 'Daily',
        component: () => import('@/views/operationAnalyse/Daily'),
      meta: { title: '每日报表分析', icon: 'nested', from: 'Canal', perm: 'bussiness|3007' }
  },
      {
        path: 'Overview',
        name: 'Overview',
        component: () => import('@/views/operationAnalyse/Overview'),
        meta: { title: '每日时段分析', icon: 'tree', from: 'Overview', perm: 'bussiness|3003' }
      },


      {
        path: 'Canal',
        name: 'Canal',
        component: () => import('@/views/operationAnalyse/Canal'),
        meta: { title: '渠道数据分析', icon: 'youhua', from: 'Canal', perm: 'bussiness|3004' }
      },

    {
      path: 'play',
          name: 'Form',
        component: () => import('@/views/productAnalyse/Play'),
        meta: { title: '用户玩法统计', icon: 'tree', from: 'play', perm: 'bussiness|2005' }
    },
    {
    path: 'Active',
        name: 'Active',
        component: () => import('@/views/user/Active'),
        meta: { title: '活跃用户统计', icon: 'form', from: 'Active', perm: 'bussiness|4002' }
  },
    ]
  },

  {
    path: '/user',
    component: Layout,
    name: '用户数据分析',
    alwaysShow: true,
    meta: { title: '用户数据分析', icon: 'user', perm: 'bussiness|4000' },
    children: [
      {
        path: 'UserStay',
        name: 'UserStay',
        component: () => import('@/views/user/UserStay'),
      meta: { title: '用户留存分析', icon: 'zhexian', perm: 'bussiness|4006' }
    },
    {
      path: 'OnPay',
          name: 'OnPay',
        component: () => import('@/views/user/OnPay'),
        meta: { title: '持续付费分析', icon: 'zhexian', perm: 'bussiness|4007' }
    },
    {
      path: 'PayAbility',
          name: 'PayAbility',
        component: () => import('@/views/user/PayAbility'),
        meta: { title: '充值分段分析', icon: 'table', from: 'PayAbility', perm: 'bussiness|4003' }
    },
    {
      path: 'PlayAbility',
          name: 'PlayAbility',
        component: () => import('@/views/user/PlayAbility'),
        meta: { title: '玩法分段分析', icon: 'nested', from: 'PlayAbility', perm: 'bussiness|4008' }
    },
      {
        path: 'NewUser',
        name: 'NewUser',
        component: () => import('@/views/user/NewUser'),
        meta: { title: '每日新用户分析', icon: 'user', perm: 'bussiness|4005' }
      },


      {
        path: 'rechargeStage',
        name: 'rechargeStage',
        component: () => import('@/views/user/rechargeStage'),
        meta: { title: '活跃用户盈亏分析', icon: 'eye', from: 'rechargeStage', perm: 'bussiness|4004' }
      }
    ]
  },
  {
    path: '/playDeep',
    component: Layout,
    name: '玩法深度分析',
    alwaysShow: true,
    meta: { title: '玩法深度分析', icon: 'zhexian', perm: 'bussiness|2000' },
    children: [
      {
        path: 'fishPump',
        name: 'fishPump',
        component: () => import('@/views/playDeep/fishPump'),
        meta: { title: '捕鱼抽水分析', icon: 'zhexian', perm: 'bussiness|2007' }
      }
    ]
  },
  {
    path: '/statement',
    component: Layout,
    name: '用户数据统计',
    alwaysShow: true,
    meta: { title: '线上报表', icon: 'user', perm: 'bussiness|5000' },
    children: [
      {
        path: 'Revenue',
        name: 'Revenue',
        component: () => import('@/views/statement/Revenue'),
        meta: { title: '产品营收', icon: 'eye', from: 'rechargeStage', perm: 'bussiness|5001' }
      },
      {
        path: 'UserAnalyse',
        name: 'UserAnalyse',
        component: () => import('@/views/statement/UserAnalyse'),
        meta: { title: '用户分析', icon: 'user', perm: 'bussiness|5002' }
      },
      {
        path: 'RuleAnalyse',
        name: 'RuleAnalyse',
        component: () => import('@/views/statement/RuleAnalyse'),
        meta: { title: '玩法分析', icon: 'user', perm: 'bussiness|5003' }
      },
      {
        path: 'ChannelAnalyse',
        name: 'ChannelAnalyse',
        component: () => import('@/views/statement/ChannelAnalyse'),
        meta: { title: '渠道分析', icon: 'user', perm: 'bussiness|5004' }
      },
      {
        path: 'ChargeAnalyse',
        name: 'ChargeAnalyse',
        component: () => import('@/views/statement/ChargeAnalyse'),
        meta: { title: '充值分析', icon: 'user', perm: 'bussiness|5005' }
      },
      {
        path: 'WithDraw',
        name: 'NewUser',
        component: () => import('@/views/statement/WithDraw'),
        meta: { title: '提现分析', icon: 'user', perm: 'bussiness|5006' }
      }
    ]
  },
  {
    path: '/role',
    component: Layout,
    name: 'role',
    alwaysShow: true,
    meta: { title: '控制台管理', icon: 'set', perm: 'bussiness|0,1' },
    children: [
      {
        path: 'userment',
        name: 'userment',
        component: () => import('@/views/role/userment'),
        meta: { title: '用户管理', icon: 'youhua' }
      },
      {
        path: 'rolement',
        name: 'rolement',
        component: () => import('@/views/role/rolement'),
        meta: { title: '角色管理', icon: 'bianji' }
      } ,
    // {
    //   path: 'recording',
    //       name: 'recording',
    //     component: () => import('@/views/merchant/recording'),
    //     meta: { title: '操作记录', icon: 'form', from: 'recording' }
    // }
    ]
  },
  {
    path: '/merchant',
    component: Layout,
    name: 'merchant',
    meta: { title: '商户管理', icon: 'bianji', perm: 'master' },
    children: [
      {
        path: 'management',
        name: 'management',
        component: () => import('@/views/merchant/management'),
        meta: { title: '商户管理', icon: 'set', from: 'lottery' }
      }

    ]
  },
  {
    path: '/merchantchoose',
    component: () => import('@/views/merchant/choose'),
    name: 'merchantchoose',
    hidden: true,
    meta: { title: '商户选择', icon: 'example' }
  },
  { path: '*', redirect: '/404', hidden: true, meta: { title: '404', icon: 'example' }}
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
